import $api from '.';

interface merchant {
  name: string;
  number: number | string;
  [key: string]: any;
}

// 添加店铺
export const addmerchant = function (data: merchant) {
  return $api.post('/merchant', data);
};

// 获取店铺列表
export const getmerchant = function (data: {[key: string]: any;}) {
  console.log('data', data);
  data.$limit = data.$limit || 20;
  data.$skip = data.$skip || 0;
  return $api.get('/merchant', {
    params: data,
  });
};

// 删除店铺
export const delmerchant = function (id: number) {
  return $api.delete(`/merchant/${id}`);
};

// 修改店铺信息
export const updatemerchant = function (id: number, data: any) {
  return $api.patch(`/merchant/${id}`, data);
};

export default {};
